import { ArticleTagEntity } from 'src/api/article/entities/article.tag.entity';
import { SharedEntity } from 'src/api/shared/entities/shared.entity';
import { Column, Entity, OneToMany } from 'typeorm';

@Entity('tag')
export class TagEntity extends SharedEntity {
  @Column({
    type: 'varchar',
    name: 'name',
    unique: true, // 唯一值
    comment: '标签名',
  })
  name: string;

  @OneToMany(() => ArticleTagEntity, (articleTag) => articleTag.tag)
  tags: ArticleTagEntity[];
}
